package com.hen.web.henweb.config;

import com.hen.web.henweb.interceptor.UserLoginCheckInterceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 狠穿
 * @version 1.0.0
 * @date 2023/4/6
 * @function
 */
@Component
public class UserLoginConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //不拦截的请求
        String[] include = {"/**"};
        //拦截的请求
        String[] exclude = {"/user/login","/error"};
        registry.addInterceptor(new UserLoginCheckInterceptor())
                .addPathPatterns(include)
                .excludePathPatterns(exclude);
    }
}
